package com.itheima_04;

import java.io.*;

public class BufferedStreamDemo01 {
    public static void main(String[] args) throws IOException {
        /*
        BufferedWriter bw = new BufferedWriter(new FileWriter("myCharStream\\ConvrsionStreamDemo.java"));
        bw.write("hello\r\n");
        bw.write("world");
        bw.close();
         */
        BufferedReader br = new BufferedReader(new FileReader("myCharStream\\ConvrsionStreamDemo.java"));

        //一次读取一个字符数据
        /*
        int ch;
        while ((ch=br.read())!=-1){
            System.out.print((char)ch);
        }

        br.close();
         */

        //一次读取一个字符数组数据
        char[] chs = new char[1024];
        int len;
        while ((len=br.read(chs))!=-1){
            System.out.println(new String(chs,0,len));
        }

        br.close();
    }
}
